enchant();

window.onload = function() {

	// 1
	game = new Game(320, 320);

	game.preload('chara1.gif');

	// 3
	game.onload = function() {

		var bear = new Sprite(32, 32);
		bear.image = game.assets['chara1.gif'];
		bear.onenterframe = function() {

			if (game.input.left) {
				bear.x -= 3;

			}

			if (game.input.right) {
				bear.x += 3;
				bear.frame += 1;
			}

		};

		game.rootScene.addChild(bear);

	}

	// 2
	game.start();
}